import defaultState from '../state/pushStore'
import { fromJS } from 'immutable'

const reducer = (state = defaultState, action) => {
  const type = action.type
  const data = action.data || ''

  switch (type) {
    case 'pushredux':
      let newState = state.set('pushStore', fromJS(data))
      // return newState.set('token', fromJS(data.token))
      return  newState ;
    case 'pushselect':
      let newState2 = state.set('pushSelect', fromJS(data))
      // return newState.set('token', fromJS(data.token))
      return  newState2 ;
    case 'fuza':
      let newState3 = state.set('pushStore', fromJS(data))
      // return newState.set('token', fromJS(data.token))
      return  newState3 ;
   
    case 'area':
      let newState4 = state.set('area', fromJS(data))
      // return newState.set('token', fromJS(data.token))
      return newState4 ;
    case 'areadesk':
      let newState5 = state.set('areadesk', fromJS(data))
      // return newState.set('token', fromJS(data.token))
      return newState5 ;
    default:
      return state
  }
}

export default reducer